package step

import _interface "adam2/internal/quant/interface"

// 更新quant_account步骤
type UpdateQuantAccountAfterBuyStep struct {
	buyDate                    *_interface.BuyDate
	updateQuantAccountAfterBuy *_interface.UpdateQuantAccount
}

// 初始化
func (u *UpdateQuantAccountAfterBuyStep) Init(buyDate *_interface.BuyDate, updateQuantAccountAfterBuy *_interface.UpdateQuantAccount) {
	u.buyDate = buyDate
	u.updateQuantAccountAfterBuy = updateQuantAccountAfterBuy
}

// 在买入之后更新quant_account
func (u *UpdateQuantAccountAfterBuyStep) UpdateQuantAccountAfterBuy(transactionDate string) {
	if (*u.buyDate).IsBuyDate(transactionDate) {
		(*u.updateQuantAccountAfterBuy).Exec(transactionDate)
	}
}
